package exer04;

/**
 * @author shkstart
 * @date 2022/5/4 - 13:07
 */
public class Account {
    private double balance;
// balance 平衡

    public Account(double init_balance){
        this.balance = init_balance;
    }

    public double getBalance(){
        return balance;
    }

    public void deposit(double atm){
        if(atm > 0){
            balance += atm;
            System.out.println("成功存入" + atm);

        }
    }

    public void withdraw(double atm){
        if(atm > balance){
            System.out.println("余额不足，取款失败");
            return;
        }

        balance -= atm;
        System.out.println("成功取出" + atm);



    }
}
